package com.sc.nft.entity.vo;

import cn.hutool.core.util.ObjectUtil;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.sc.nft.enums.ChainStatusEnum;
import com.sc.nft.enums.CollectionOnConsignEnum;
import com.sc.nft.enums.UserCollectionFreezingStatusEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

@Data
public class UserCollectionExcelVO {

    private static final long serialVersionUID = 1L;


    @ApiModelProperty("藏品Id")
    @ExcelProperty("藏品Id")
    private Long collectionId;

    @ApiModelProperty("藏品名称")
    @ExcelProperty("藏品名称")
    private String firstTitle;

    @ApiModelProperty("藏品图片")
    @ExcelProperty("藏品图片")
    private String creationContent;

    @ApiModelProperty("是否开启")
    @ExcelProperty("是否开启")
    private Boolean isOpen;

    @ApiModelProperty("盲盒名称")
    @ExcelProperty("盲盒名称")
    private String boxTitle;

    @ApiModelProperty("购买类型")
    @ExcelIgnore
    private Integer type;

    @ApiModelProperty("盲盒图片")
    @ExcelProperty("盲盒图片")
    private String boxImage;

    @ApiModelProperty("上链状态")
    @ExcelProperty("上链状态")
    private String statusText;

    @ApiModelProperty("寄售状态")
    @ExcelProperty("寄售状态")
    private String onConsignText;

    @ApiModelProperty("质押状态")
    @ExcelProperty("质押状态")
    private String freezingStatusText;

    @ApiModelProperty("上链状态")
    @ExcelIgnore
    @JsonIgnore
    private ChainStatusEnum status;

    @ApiModelProperty("寄售状态")
    @ExcelIgnore
    @JsonIgnore
    private CollectionOnConsignEnum onConsign;

    @ApiModelProperty("质押状态")
    @ExcelIgnore
    @JsonIgnore
    private UserCollectionFreezingStatusEnum freezingStatus;

    @ApiModelProperty("藏品编号")
    @ExcelProperty("藏品编号")
    private Integer numbering;

    @ApiModelProperty("用户手机号")
    @ExcelProperty("用户手机号")
    private String userTel;

    @ApiModelProperty("上级手机号")
    @ExcelProperty("上级手机号")
    private String superiorTel;

    @ApiModelProperty("购买时间")
    @ExcelProperty("购买时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @ApiModelProperty(value = "购买渠道", hidden = true)
    @ExcelProperty("购买渠道")
    @JsonIgnore
    private String typeName;




    public void setStatusText(ChainStatusEnum status) {
        if (ObjectUtil.isNotNull(status)){
            this.statusText = this.status.getDescription();
        }
    }

    public void setOnConsignText(CollectionOnConsignEnum onConsign) {
        switch (onConsign) {
            case NORMAL:
                this.onConsignText ="正常";
                break;
            case ON_SALES:
                this.onConsignText ="寄售中";
                break;
            case ON_COLLECTIVE:
                this.onConsignText ="集售中";

                break;
        }
    }

    public void setFreezingStatusText(UserCollectionFreezingStatusEnum freezingStatus) {
        if (ObjectUtil.isNotNull(freezingStatus)){
            this.freezingStatusText = freezingStatus.getDescription();
        }

    }
}
